package cfi.jdo;

import com.google.appengine.api.datastore.Key;

import java.util.Date;
import java.util.List;

import javax.jdo.annotations.Element;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable(detachable = "true")
public class CoffeeCustomer {

	// ﾌｪﾘｶＩＤＭ
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key;

	// ユーザ名
	@Persistent
	private String name;

	// 購入履歴
	@Persistent(mappedBy = "coffeeCustomer")
	@Element(dependent = "true")
	private List<Purchase> purcaseList;

	// チケット
	@Persistent(mappedBy = "coffeeCustomer")
	@Element(dependent = "true")
	private List<Ticket> ticketList;

	// サービス開始
	@Persistent
	private Date serviceStartDate;

	public CoffeeCustomer(String name, Date date) {
		this.name = name;
		this.serviceStartDate = date;
	}

	public Key getKey() {
		return key;
	}

	public void setKey(Key key) {
		this.key = key;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<Purchase> getPurcaseList() {
		return purcaseList;
	}

	public void setPurcaseList(List<Purchase> purcaseList) {
		this.purcaseList = purcaseList;
	}

	public List<Ticket> getTicketList() {
		return ticketList;
	}

	public void setTicketList(List<Ticket> ticketList) {
		this.ticketList = ticketList;
	}

	public Date getServiceStartDate() {
		return serviceStartDate;
	}

	public void setServiceStartDate(Date serviceStartDate) {
		this.serviceStartDate = serviceStartDate;
	}

}
